function validMobile() {
  let mobile = '1387776661331'
  if (mobileReg.test(mobile)) {
    console.log('验证通过')
  } else {
    console.log('电话不正确')
  }
}
validMobile()
function validUsername() {
  let name = 'sss'
  if (usernameReg.test(name)) {
    console.log('验证通过')
  } else {
    console.log('用户名不正确')
  }
}
validUsername()
function validDate() {
  // 只能验证格式，不能验证数字范围
  let date = '1234-45-23 12:34:90'
  let rt = dateReg.test(date)
  console.log(rt)
}
validDate()
function validImg() {
  let suffix = 'svg'
  console.log(imgReg.test(suffix)) // false
}
validImg()
function validAge() {
  console.log(ageReg.test(123))
}

let str1 = 'abc345efg' //abc[3][4][5]efg
let st = str1.replace(/\d/g, function (item) {
  return '[' + item + ']'
})
console.log(st)
